<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.validate.js"></script>
<script type="text/javascript" src="jquery.validate.messages_cn.js"></script>
<script type="text/javascript">
	$(function(){
		$("#registForm").validate(
			{
				rules: {
					name : "required",
					pwd : {
						required:true,
						rangelength:[6,10]
					},
					repwd : {
						required:true,
						equalTo:"#pwd"//需要和id=pwd元素对应
					},
					email : {
						required:true,
						email:true
					},
					birth : {
					    required:true,
					    dateISO:true
					}
				},
				messages:{//自定义提示信息
					name:{
						required:"用户名不能为空!"
					},
					pwd:{
						required:"密码不能为空!",
						rangelength:"密码必须在6-10位!"
					}
				}
			}
		);
	});
</script>
</head>
<body>
<h1>jQuery表单校验插件示例</h1>
<form id="registForm" action="a.jsp" method="post">
	用户名：<input type="text" name="name"><br/>
	密码：<input type="password" name="pwd" id="pwd"><br/>
	确认密码：<input type="password" name="repwd"><br/>
	Email地址：<input type="text" name="email"><br/>
	生日：<input type="text" name="birth"><br/>
	<input type="submit" value="注册">
</form>

</body>
</html>